﻿@model IEnumerable<tutors_clus.Models.news>
<table id="result">
    <tr>
        <th>
            @Html.ActionLink("Tiêu đề", "Show_News", new {order = ViewBag.Titles,page = ViewBag.PageNumber})
            @*@Html.DisplayNameFor(model => model.title_new)*@
        </th>
        <th>
            @Html.DisplayNameFor(model => model.image_news)
        </th>
        <th>
            @Html.ActionLink("Ngày tạo", "Show_News", new {order = ViewBag.Date,page = ViewBag.PageNumber})
        </th>
        <th>
            @Html.DisplayNameFor(model => model.writer_new)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.status_new)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.title_new)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.image_news)
        </td>
        <td>
            @Html.DisplayFor(m => item.create_date_new)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.writer_new)
        </td>
       <td id="@item.id_new">
          
            @if (item.status_new == true)
            {
                @Ajax.ActionLink("tick", "Change_sta_news", new {id = item.id_new}, new AjaxOptions {InsertionMode=InsertionMode.Replace, UpdateTargetId = item.id_new.ToString()},new { @class="true" })
            }
            else
            {
                 @Ajax.ActionLink("tick", "Change_sta_news", new {id = item.id_new}, new AjaxOptions {InsertionMode=InsertionMode.Replace, UpdateTargetId = item.id_new.ToString()},new { @class="false" })
            }
        </td>
        <td>
            @Html.ActionLink("Sửa", "Edit_news", new { id=item.id_new}) |
            @Html.ActionLink("Chi tiết", "Detail_news", new { id=item.id_new}) |
            <input type="button" title="Xóa tin tức" value="Xóa" onclick="if (confirm('Bạn có chắc muốn xóa không?')) location.href='@Url.Action("Delete_News", "Admin", new { id = item.id_new })'" />
        </td>
    </tr>
}

</table>

